package cn.vehicle.domains.vo.res.vehicle;

import cn.vehicle.enums.EmissionStandardEnum;
import cn.vehicle.enums.FuelTypeEnum;
import cn.vehicle.enums.TransportVehicleTypeEnum;
import cn.vehicle.enums.UsageNatureEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

@Data
@Schema(description = "运输车辆查询响应结果")
public class TransportVehicleRes {

    @Schema(name = "id", description = "运输车辆ID")
    private Long id;

    @Schema(name = "vehicleNumber", description = "车牌号")
    private String vehicleNumber;

    @Schema(name = "transportVehicleType", description = "运输车辆类型")
    private String transportVehicleType;

    @Schema(name = "transportVehicleTypeDesc", description = "运输车辆类型描述")
    private String transportVehicleTypeDesc;

    @Schema(name = "registerTime", description = "注册日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date registerTime;

    @Schema(name = "vehicleBrand", description = "车辆品牌")
    private String vehicleBrand;

    @Schema(name = "vehicleModel", description = "车辆型号")
    private String vehicleModel;

    @Schema(name = "fuelType", description = "燃料类型")
    private String fuelType;

    @Schema(name = "fuelTypeDesc", description = "燃料类型描述")
    private String fuelTypeDesc;

    @Schema(name = "emissionStandard", description = "排放标准")
    private String emissionStandard;

    @Schema(name = "emissionStandardDesc", description = "排放标准描述")
    private String emissionStandardDesc;

    @Schema(name = "networkStatus", description = "联网状态（ONLINE-在线，OFFLINE-离线）")
    private String networkStatus;

    @Schema(name = "usageNature", description = "使用性质")
    private String usageNature;

    @Schema(name = "usageNatureDesc", description = "使用性质描述")
    private String usageNatureDesc;

    @Schema(name = "attachedListUrl", description = "随车清单URL")
    private String attachedListUrl;

    @Schema(name = "drivingLicenseUrl", description = "驾驶证URL")
    private String drivingLicenseUrl;

    @Schema(name = "createTime", description = "系统录入时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @Schema(name = "engineNo", description = "发动机编码")
    private String engineNo;

    @Schema(name = "engineType", description = "发动机型号")
    private String engineType;

    @Schema(name = "engineManufacturer", description = "发动机制造商")
    private String engineManufacturer;

    @Schema(name = "govUploadStatus", description = "上传政府状态（INIT/SUCCESS/FAIL）")
    private String govUploadStatus;

    @Schema(name = "vehiclePhone", description = "车主联系电话")
    private String vehiclePhone;

    @Schema(name = "vehicleAddress", description = "车主地址或常停位置")
    private String vehicleAddress;

    @Schema(name = "ownerName", description = "车主姓名")
    private String ownerName;

    @Schema(name = "vehiclePlateColor", description = "车牌颜色")
    private String vehiclePlateColor;

    @Schema(name = "vin", description = "车辆识别代号（VIN码）")
    private String vin;

    public void setTransportVehicleType(String transportVehicleType) {
        this.transportVehicleType = transportVehicleType;
        this.transportVehicleTypeDesc = TransportVehicleTypeEnum.valueOf(transportVehicleType).getDesc();
    }

    public void setEmissionStandard(String emissionStandard) {
        this.emissionStandard = emissionStandard;
        this.emissionStandardDesc = EmissionStandardEnum.valueOf(emissionStandard).getDesc();
    }

    public void setUsageNature(String usageNature) {
        this.usageNature = usageNature;
        this.usageNatureDesc = UsageNatureEnum.valueOf(usageNature).getDesc();
    }

    public void setFuelType(String fuelType) {
        this.fuelType = fuelType;
        this.fuelTypeDesc = FuelTypeEnum.valueOf(fuelType).getDesc();
    }
}